Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add gql request name support #2419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

itssharmasandeep
Copy link
Contributor

⚠️ Issue

Currently, we fire a lot of queries of the same type, for example: we may fire up to 10 different entity queries for different use cases. Since we have a number of queries of the same type, debugging becomes difficult for the teams as they have to look for the schema to realize which query is failing and what is the use case.

💡 Solution

Added an optional attribute name in the Graphql options which can be used to fire a names query depending upon the use case

Before

query {...}

After

query abcd {...}

@itssharmasandeep itssharmasandeep requested a review from a team as a code owner September 21, 2023 13:28
@@ -155,7 +155,7 @@ export class GraphQlRequestService {
): Observable<TResponse> {
return this.apollo
.query<TResponse>({
query: gql(requestString),
query: gql(`query ${options?.name ?? ''} ${requestString}`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work with current batching behavior? I would think it would either break or prevent batching - neither good. Work to push the name further down so multiple named queries can be grouped (you might want to use alias rather than a query name, for example).

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #2419 (100d43c) into main (02e5209) will decrease coverage by 25.83%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##             main    #2419       +/-   ##
===========================================
- Coverage   82.83%   57.00%   -25.83%     
===========================================
  Files         921      921               
  Lines       20547    20549        +2     
  Branches     3241     3243        +2     
===========================================
- Hits        17020    11714     -5306     
- Misses       3402     8445     +5043     
- Partials      125      390      +265     
Files Changed Coverage Δ
projects/graphql-client/src/graphql-config.ts 100.00% <ø> (ø)
...ects/graphql-client/src/graphql-request.service.ts 10.44% <0.00%> (-83.50%) ⬇️

... and 211 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

Unit Test Results

       4 files  ±0     310 suites  ±0   49m 59s ⏱️ + 6m 59s
1 123 tests ±0  1 117 ✔️  - 6  0 💤 ±0  6 ❌ +6 
1 133 runs  ±0  1 127 ✔️  - 6  0 💤 ±0  6 ❌ +6 

For more details on these failures, see this check.

Results for commit 100d43c. ± Comparison against base commit 02e5209.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants